# Python 2.6.4
# Project Euler, Problem 73
# Copyright 2010 Talha Zaman

def relpr(n,m):
    if n < m: n, m = m, n
    while (n%m): n, m = m, n%m
    return m==1
count = 0
for i in range(1,10001):
    for j in range(i/3+(i%3!=0), (i/2)+1):
        if relpr(i,j): count += 1
print count-2
